package com.zxw.service.impl;

import com.aaa.entity.GDeposit;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zxw.dao.GDepositMapper;
import com.zxw.service.GDepositService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 86176
* @description 针对表【g_deposit(保存方式)】的数据库操作Service实现
* @createDate 2023-02-28 19:01:20
*/
@Service
@SuppressWarnings("all")
public class GDepositServiceImpl extends ServiceImpl<GDepositMapper, GDeposit>
    implements GDepositService{

    @Autowired
    private GDepositMapper gDepositMapper;

    @Override
    public Result findAllDeposits(GDeposit deposit, Integer pageCurrent, Integer pageSize) {
        PageHelper.startPage(pageCurrent, pageSize);
        List<GDeposit> allDeposits = gDepositMapper.findAllDeposits(deposit.getId(), deposit.getStatus());
        PageInfo<GDeposit> pageInfo = new PageInfo<>(allDeposits);
        return new Result(2000,"查询成功",pageInfo);
    }

    @Override
    public Result findAllDeposit() {
        QueryWrapper queryWrapper = new QueryWrapper();
        List<GDeposit> list = gDepositMapper.selectList(queryWrapper);
        return new Result<>(2000,"查询成功",list);
    }

    @Override
    public Result updateDeposit(GDeposit deposit) {
        gDepositMapper.updateById(deposit);
        return new Result<>(2000,"修改成功");
    }

    @Override
    public Result deleteDeposit(Integer id) {
        gDepositMapper.deleteById(id);
        return new Result<>(2000,"删除成功");
    }
}




